<?
//impostazioni del modulo news
include("includes/config.inc.php");
include("includes/auth.lib.php");
include("includes/function.inc.php");
include("includes/e-commerce_new.class.php");
include("includes/product_new.class.php");
include("includes/genpass.class.php");
$module="UTENTI WEB";
$adminmail = "info@bsvillage.com";
switch($lang) {
  case "ita":
	$currentlang = " - ITA";
  break;

  case "eng":
	$currentlang = " - ENG";
  break;

  case "fra":
	$currentlang = " - FRA";
  break;
}
$javascript = "function control_user()  {
   if(document.insertuser.cognome.value==\"\")  {
     alert('Devi inserire almeno il cognome!');
     return false;
   }
}
";
   list($status, $user) = auth_get_status();
   switch($status){
       case AUTH_LOGGED:
            $result1 = @mysql_query("SELECT nome,stato FROM utenti WHERE id='$id_user';");
            list($username,$level) = mysql_fetch_row($result1);
	if($level == "admin")  {
            //recupero i dati in post
                $op = $_GET['op'];
                if(!isset($op) && $op=="")
                 $op = $_POST['op'];
                $num_per_page = 10;
                $idwebuser = $_GET['idwebuser'];
                if(!isset($idwebuser) || $idwebuser=="")
                 $idwebuser = $_POST['idwebuser'];
              if($id_user == "")
               $id_user = $_POST['id_user'];
               $nome = $_POST['nome'];
			   $cognome = $_POST['cognome'];
               $ragione = $_POST['ragione'];
			   $data = $_POST['data_nascita'];
			   list($g,$m,$a) = explode("/",$data);
			   $data = "$a-$m-$g";
			   $cf = $_POST['cf'];
               $iva = $_POST['iva'];
               $indirizzo = $_POST['indirizzo'];
			   $localita = $_POST['localita'];
			   $provincia = $_POST['provincia'];
			   $cap = $_POST['cap'];
			   $nazione = $_POST['nazione'];
			   $telefono = $_POST['telefono'];
			   $cellulare = $_POST['cellulare'];
			   $mail = $_POST['mail'];
			   $password = $_POST['password'];
			   $indirizzo_s = $_POST['indirizzo_s'];
			   $localita_s = $_POST['localita_s'];
			   $provincia_s = $_POST['provincia_s'];
			   $cap_s = $_POST['cap_s'];
			   $search = $_POST['search'];
			    $menusx = "<table width=200 cellpadding=3>
							<tr>
							  <td valign=middle width=30 height=30><a class=menusx href=webuser.php?op=all><img src=\"imgs/ico_list.gif\" width=30 height=30 alt=\"Elenco Anagrafica clienti\" border=0></a></td><td align=left valign=middle><a class=menusx href=webuser.php?op=all>Elenco Anagrafica clienti</a></td>
							</tr>
							<tr>
							  <td valign=middle width=30 height=30><a class=menusx href=webuser.php?op=add><img src=\"imgs/ico_add.gif\" width=30 height=30 alt=\"Aggiungi Anagrafica clienti\" border=0></a></td><td align=left valign=middle><a class=menusx href=webuser.php?op=add>Aggiungi Anagrafica clienti</a></td>
							</tr>";
				$menusx .= '<tr>
						<td valign=middle width=30 height=30><a class=menusx
							href="webuser.php?op=anag_prod"><img src="imgs/ico_list.gif"
							width=30 height=30 alt="Anagrafica Fornitori / Produttori" border=0></a></td>
						<td align=left valign=middle><a class=menusx
							href="webuser.php?op=anag_prod">Anagrafica Fornitori / Produttori</a></td>
					</tr>
				<tr>
						<td valign=middle width=30 height=30><a class=menusx
							href="webuser.php?op=anag_varianti"><img src="imgs/ico_list.gif"
							width=30 height=30 alt="Anagrafica Varianti" border=0></a></td>
						<td align=left valign=middle><a class=menusx
							href="webuser.php?op=anag_varianti">Anagrafica Filtri</a></td>
					</tr>';			
				$menusx	.= "<tr>
							  <td valign=middle width=30 height=30><a class=menusx href=webuser.php?op=feedback><img src=\"imgs/feedback.gif\" width=30 height=30 alt=\"Feedback\" border=0></a></td><td align=left valign=middle><a class=menusx href=webuser.php?op=feedback>Gestione Feedback</a></td>
							</tr>
							<tr>
							  <td valign=middle width=30 height=30><a class=menusx href=webuser.php?op=vendite><img src=\"imgs/vendite.gif\" width=30 height=30 alt=\"Ultime vendite\" border=0></a></td><td align=left valign=middle><a class=menusx href=webuser.php?op=vendite>Ultime vendite</a></td>
							</tr>
							<tr>
							 <td colspan=2>&nbsp;</td>
							</tr>
							<tr>
							 <td colspan=2>&nbsp;</td>
							</tr>
							<tr>
							 <td colspan=2>&nbsp;</td>
							</tr>
							<tr>
							  <td valign=middle width=30 height=30><a class=menusx href=gestione.php><img src=\"imgs/ico_back.gif\" width=30 height=30 alt=Principale border=0></a></td><td align=left valign=middle><a class=menusx href=gestione.php>Torna alla pagina principale</a></td>
							</tr>
							</table>";

#############################################opzioni possibili##################################

            switch ($op)  {
			  
			  case "all":
			  //recupero dati in GET
			            $min = $_GET['min'];
                        $max = $_GET['max'];
                        $page = $_GET['page'];
                     if (!isset($min))
                      $min= 0;
                     if (!isset($max))
                      $max = $num_per_page;
                     if (!isset($page))
                      $page = 1;
			   switch($lang)  {
			     case "ita":
				   $qry_tot = "SELECT idwebuser FROM webuser WHERE nazione='IT';";
				   $qry = "SELECT idwebuser,creation,nome,cognome,ragione FROM webuser WHERE nazione='IT' ORDER BY creation,ragione,cognome ASC LIMIT $min,$max;";
				 break;
				 
			     case "eng":
				   $qry_tot = "SELECT idwebuser FROM webuser WHERE nazione<>'IT';";
				   $qry = "SELECT idwebuser,creation,nome,cognome,ragione FROM webuser WHERE nazione<>'IT' ORDER BY creation,ragione,cognome ASC LIMIT $min,$max;";
				 break;
			   }
               
               $r_tot = $conn->Execute($qry_tot);
               
               $rs = $conn->Execute($qry);
               $num_user = $r_tot->RecordCount();
                 $content = "<table class=\"content\" width=\"100%\" align=\"center\" cellpadding=\"3\" cellspacing=\"0\">\n"
                 ."<tr>
					<td colspan=3>Sono registrati sul sito <b>$num_user</b> utenti.</td>
				 	</tr>
				 <tr>
				 	<td class=\"tbtit\" align=\"\" width=\"20%\"><b>Registrazione</b></td>
				 	<td class=\"tbtit\" align=\"\" width=\"30%\"><b>Ragione sociale</b></td>
					<td class=\"tbtit\" align=\"\" width=\"30%\"><b>ID - Cognome Nome</b></td><td class=\"tbtit\" align=\"center\" width=\"20%\"><b>Azioni</b></td></tr>\n";
			if($num_user > 0)  {	 
               while (list($idwebuser,$creation,$nome,$cognome,$ragione) = @array_values($rs->FetchRow()))  {
                 list($a,$m,$g) = explode("-",$creation);
                 $creation = "$g/$m/$a";
                 $content .= "<tr>
				 			<td class=tdelenco>&nbsp;$creation</td>
							<td class=tdelenco>&nbsp;$ragione\n";
                 $content .= "</td>\n<td class=tdelenco>$idwebuser&nbsp;-&nbsp;$cognome $nome</td>\n";
                 $content .= "<td align=\"center\" valign=\"middle\" class=tdelenco><a href=\"webuser.php?op=mod&idwebuser=$idwebuser\"><img src=\"imgs/ico_edit.gif\" alt=\"modifica\" width=16 height=16 title=\"modifica\" border=\"0\"></a>&nbsp;&nbsp;
                  <a href=\"webuser.php?op=delete&idwebuser=$idwebuser\" onclick='return confirm(\"Sei sicuro di voler eliminare questo utente? Verranno eliminati tutti i suoi ordini! Vuoi procedere?\")'><img src=\"imgs/ico_delete.gif\" width=16 height=16 alt=\"cancella\" title=\"cancella\" border=\"0\"></a>&nbsp;&nbsp;<a href=\"webuser.php?op=stat&idwebuser=$idwebuser\"><img src=\"imgs/ico_ordini.gif\" alt=\"Vedi ordini\" width=16 height=16 title=\"Ordini\" border=\"0\"></a>&nbsp;&nbsp;
				  <a href=\"webuser.php?op=send_password&idwebuser=$idwebuser\"><img src=\"imgs/ico_mail.gif\" alt=\"Invia nuova password\" width=16 height=16 title=\"Invia nuova password\" border=\"0\"></a>";
                 $content .= "</td></tr>\n";
               }
				 $rs->Close();
				 $r_tot->Close();
               //$content .= "</table>\n";
               //inizio paginazione
                     $content .= "<tr><td colspan=3><table class=\"tbtit\" width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\n";
                     $num_pages = ($num_user/$num_per_page) + 1;
                     $resto =  $num_user%$num_per_page;
                     if ($resto==0)
                      $num_pages--;
                     $content .= "<tr><td align=\"left\">";
                     if ($min!=0)   {
                      $min1 = $min-$num_per_page;
                      $max1 = $max-$num_per_page;
                      if ($page!=1)
                       $page1 = $page-1;;
                      $content .= "<a href=\"webuser.php?op=all&min=$min1&max=$num_per_page&page=$page1\"><img src=\"imgs/precedente.gif\" border=\"0\" alt=\"precedente\"></a>&nbsp;&nbsp;&nbsp;";
                      }
                      $content .= "</td><td align=\"center\">";
                     for ($i=1;$i<=$num_pages;$i++)  {
                       if ($page!=$i)  {
                        $max1 = $i*$num_per_page;
                        $min1 = $max1 - $num_per_page;
                        $content .= "<a href=\"webuser.php?op=all&min=$min1&max=$num_per_page&page=$i\"><b>$i</b></a>";
                        $content .= "  ";
                       }  else
                         $content .= "  $i  ";
                     }
                     $content .= "</td><td align=\"right\">";
                     $diff2 = $num_user - ($num_per_page*$page);
                     if ($diff2 > 0)   {
                      $min1 = $min + $num_per_page;
                      $max1 = $max + $num_per_page;
                      $page1 = $page + 1;
                      $content .= "&nbsp;&nbsp;&nbsp;<a href=\"webuser.php?op=all&min=$min1&max=$num_per_page&page=$page1\"><img src=\"imgs/successivo.gif\" border=\"0\" alt=\"successivo\"></a>";
                     }
                     $content .= "</td></tr></table>\n";
					}
					 $content .= "</td></tr>
					 <tr>
					  <td colspan=3>&nbsp;</td>
					 </tr>
					 <tr>
					  <td colspan=3 align=center>
					   <table width=500 class=content cellpadding=2 bgcolor=#CCCCCC>
					    <form action=webuser.php method=POST>
					    <tr>
						 <td width=250 align=right>Ricerca per cognome / ragione sociale / e-mail:</td>
						 <td width=150><input type=text name=search size=30></td>
						 <td><input type=hidden name=op value=search><input type=submit value=Cerca></td>
						</tr>
						</form>
					   </table>
					  </td>
					 </tr>
					 <tr>
					  <td colspan=3>&nbsp;</td>
					 </tr>
					 </table>\n";
			  break;	

              case "save":
               $newUser = new webuser('',$nome,$cognome,$ragione,$data,$cf,$iva,$indirizzo,$localita,$cap,$provincia,$nazione,$telefono,$cellulare,$mail,$password,$indirizzo_s,$localita_s,$cap_s,$provincia_s);
               $error = $newUser->save();
			   if ($error == "0")  {
			    Header("Location:webuser.php?op=all");
			   }  else  {
			    $content = printError($error);
			   }
              break;

              case "mod":
               $newUser = new webuser($idwebuser);
			   list($a,$m,$g) = explode("-",$newUser->data);
			   $data_nascita = "$g/$m/$a";
				   $content = "<table width=100% cellpadding=3 cellspacing=0 class=content>
				   			<form name=\"insertuser\" action=\"webuser.php\" method=\"POST\">
				   	<tr><td align=\"center\" class=tbtit colspan=2><b>Modifica Utente</b></td></tr>
					<tr><td align=right width=200>Nome:</td><td><input type=\"text\" name=\"nome\" size=30 value=\"$newUser->nome\"/></td>
				   </tr>
                   <tr>
				    <td align=right>Cognome:</td><td><input type=\"text\" name=\"cognome\" size=\"30\" value=\"$newUser->cognome\"/></td>
					</tr>
                   <tr>
				    <td align=right>Username:</td><td><input type=\"text\" name=\"ragione\" size=\"30\" value=\"$newUser->ragione\"/></td>
					</tr>
                   <tr>
				    <td align=right>Data di nascita:</td><td><input type=\"text\" name=\"data_nascita\" size=\"30\" value=\"$data_nascita\"/></td>
					</tr>
                   <tr>
				    <td align=right>Codice fiscale:</td><td><input type=\"text\" name=\"cf\" size=\"30\" value=\"$newUser->cf\"/></td>
					</tr>
                   <tr>
				    <td align=right>Partita iva:</td><td><input type=\"text\" name=\"iva\" size=\"30\" value=\"$newUser->iva\"/></td>
					</tr>
                   <tr>
				    <td align=right>Indirizzo:</td><td><input type=\"text\" name=\"indirizzo\" size=\"30\" value=\"$newUser->indirizzo\"/></td>
					</tr>
                   <tr>
				    <td align=right>Localit&aacute;:</td><td><input type=\"text\" name=\"localita\" size=\"30\" value=\"$newUser->localita\"/></td>
					</tr>
                   <tr>
				    <td align=right>CAP:</td><td><input type=\"text\" name=\"cap\" size=\"30\" value=\"$newUser->cap\"/></td>
					</tr>
                   <tr>
				    <td align=right>Provincia:</td><td>";
					  //select provincia
					  $sql = "SELECT provincia,sigla FROM province ORDER BY provincia;";
					  $rsmenu = $conn->Execute($sql);
					  $content .= $rsmenu->GetMenu2("provincia",$newUser->provincia);
					  $rsmenu->Close();
					$content .= "</td>
					</tr>
                   <tr>
				    <td align=right>Nazione:</td><td>";
					//select nazione
					  $sql = "SELECT valore,id FROM nazioni ORDER BY valore;";
					  $rsmenu = $conn->Execute($sql);
					  $content .= $rsmenu->GetMenu2("nazione",$newUser->nazione);
					  $rsmenu->Close();
					$content .= "</td>
					</tr>
                   <tr>
				    <td align=right>Telefono casa:</td><td><input type=\"text\" name=\"telefono\" size=\"30\" value=\"$newUser->telefono\"/></td>
					</tr>
                   <tr>
				    <td align=right>Telefono cellulare:</td><td><input type=\"text\" name=\"cellulare\" size=\"30\" value=\"$newUser->cellulare\"/></td>
					</tr>
                   <tr>
				    <td align=right>E-mail:</td><td><input type=\"text\" name=\"mail\" size=\"30\" value=\"$newUser->mail\"/></td>
					</tr>
                   <tr>
				    <td align=right>Password:</td><td><input type=\"text\" name=\"password\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>Indirizzo spedizione:</td><td><input type=\"text\" name=\"indirizzo_s\" size=\"30\" value=\"$newUser->indirizzo_s\"/></td>
					</tr>
                   <tr>
				    <td align=right>Localit&aacute; spedizione:</td><td><input type=\"text\" name=\"localita_s\" size=\"30\" value=\"$newUser->localita_s\"/></td>
					</tr>
                   <tr>
				    <td align=right>CAP spedizione:</td><td><input type=\"text\" name=\"cap_s\" size=\"30\" value=\"$newUser->cap_s\"/></td>
					</tr>
                   <tr>
				    <td align=right>Provincia spedizione:</td><td>";
					  //select provincia
					  $sql = "SELECT provincia,sigla FROM province ORDER BY provincia;";
					  $rsmenu = $conn->Execute($sql);
					  $content .= $rsmenu->GetMenu2("provincia_s",$newUser->provincia_s);
					  $rsmenu->Close();
					$content .= "</td>
					</tr>
					<tr><td align=center colspan=2>
					<input type=hidden name=idwebuser value=\"$newUser->idwebuser\">
					<input type=\"hidden\" name=\"op\" value=\"update\" />\n
                   <input type=\"image\" src=\"imgs/ico_save.gif\" title=\"Aggiungi\"/ onclick=\"return control_user();\">&nbsp;&nbsp;<a href=\"javascript:document.insertuser.submit();\" onclick=\"return control_user();\">Salva modifiche</a> - <a href=\"javascript:document.insertuser.reset();\"><img src=\"imgs/reset.gif\" alt=\"Reset\" border=0/>&nbsp;&nbsp;Annulla modifiche</a></td></tr></form>
				   </table>";
              break;

              case "update":
               $newUser = new webuser($idwebuser);
               $error = $newUser->update($nome,$cognome,$ragione,$data,$cf,$iva,$indirizzo,$localita,$cap,$provincia,$nazione,$telefono,$cellulare,$mail,$password,$indirizzo_s,$localita_s,$cap_s,$provincia_s);
			    $content = printError($error);
              break;

              case "delete":
               $newUser = new webuser($idwebuser);
               $error = $newUser->delete();
			   $content = printError($error,"webuser.php?op=all");
              break;

              case "add":
				   $content = "<table width=100% cellpadding=3 cellspacing=0 class=content>
				   			<form name=\"insertuser\" action=\"webuser.php\" method=\"POST\">
				   	<tr><td align=\"center\" class=tbtit colspan=2><b>Aggiungi Utente</b></td></tr>
					<tr><td align=right width=200>Nome:</td><td><input type=\"text\" name=\"nome\" size=30/></td>
				   </tr>
                   <tr>
				    <td align=right>Cognome:</td><td><input type=\"text\" name=\"cognome\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>Ragione sociale:</td><td><input type=\"text\" name=\"ragione\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>Data di nascita:</td><td><input type=\"text\" name=\"data_nascita\" size=\"30\" value=\"gg/mm/aaaa\"/></td>
					</tr>
                   <tr>
				    <td align=right>Codice fiscale:</td><td><input type=\"text\" name=\"cf\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>Partita iva:</td><td><input type=\"text\" name=\"iva\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>Indirizzo:</td><td><input type=\"text\" name=\"indirizzo\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>Localit&aacute;:</td><td><input type=\"text\" name=\"localita\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>CAP:</td><td><input type=\"text\" name=\"cap\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>Provincia:</td><td>";
					  //select provincia
					  $sql = "SELECT provincia,sigla FROM province ORDER BY provincia;";
					  $rsmenu = $conn->Execute($sql);
					  $content .= $rsmenu->GetMenu("provincia");
					  $rsmenu->Close();
					$content .= "</td>
					</tr>
                   <tr>
				    <td align=right>Nazione:</td><td>";
					//select nazione
					  $sql = "SELECT valore,id FROM nazioni ORDER BY valore;";
					  $rsmenu = $conn->Execute($sql);
					  $content .= $rsmenu->GetMenu("nazione");
					  $rsmenu->Close();
					$content .= "</td>
					</tr>
                   <tr>
				    <td align=right>Telefono casa:</td><td><input type=\"text\" name=\"telefono\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>Telefono cellulare:</td><td><input type=\"text\" name=\"cellulare\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>E-mail:</td><td><input type=\"text\" name=\"mail\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>Password:</td><td><input type=\"text\" name=\"password\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>Indirizzo spedizione:</td><td><input type=\"text\" name=\"indirizzo_s\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>Localit&aacute; spedizione:</td><td><input type=\"text\" name=\"localita_s\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>CAP spedizione:</td><td><input type=\"text\" name=\"cap_s\" size=\"30\" /></td>
					</tr>
                   <tr>
				    <td align=right>Provincia spedizione:</td><td>";
					  //select provincia
					  $sql = "SELECT provincia,sigla FROM province ORDER BY provincia;";
					  $rsmenu = $conn->Execute($sql);
					  $content .= $rsmenu->GetMenu("provincia_s");
					  $rsmenu->Close();
					$content .= "</td>
					</tr>
					<tr><td align=center colspan=2><input type=\"hidden\" name=\"op\" value=\"save\" />\n
                   <input type=\"image\" src=\"imgs/ico_save.gif\" title=\"Aggiungi\"/ onclick=\"return control_user();\"> - <a href=\"javascript:document.insertuser.submit();\" onclick=\"return control_user();\">Salva</a></td></tr></form>
				   </table>";
              break;
			  
			  case "search":
			    $content = webuser::search($search);
			  break;
			  
			  case "stat":
			    $idwebuser = $_GET['idwebuser'];
				$newUser = new webuser($idwebuser);
				$content = $newUser->getStat();
			  break;
			  
			  case "send_spedizione":
			    $spedizione = $_POST['spedizione'];
				$pid = $_POST['pid'];
				$newOrder = new order($pid);
				$error = $newOrder->setSpedizione($spedizione);
				$adminmail = "info@lauropaolini.net";
				$user = new webuser($newOrder->idwebuser);		 
				if($error == 0)  {
					list($a,$m,$g) = explode("-",$newOrder->data);
					$nazione = $user->getNazione();
					switch($nazione)  {
						case "Italy":
							$data = "$g/$m/$a";
				  			//invio l'importo all'utente ita
							$subject = "Aggiornamento spese di spedizione da www.lauropaolini.net";
							$from = "MIME-Version: 1.0\nFrom: $adminmail\nReply-To: $adminmail\nContent-type: text/html; charset=iso-8859-1\n";
							$message = "<HTML>
		<HEAD> 
		<META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\"> 
		<link href=\"http://www.lauropaolini.net/CSS/tattoo.css\" rel=\"stylesheet\" type=\"text/css\"></HEAD>
		<body>
		<table width=500 class=plain cellpadding=2>
										<tr>
										  <td width=500>Gentile cliente, le comunichiamo l'importo delle spese di spedizione relative all'ordine N� TAT$pid inoltrato il $data.<br>
										  SPESE DI SPEDIZIONE = <b>".number_format($spedizione,2,",",".")." &euro;<br>
										  TOTALE ORDINE = ".number_format($newOrder->totale,2,",",".")." + ".number_format($spedizione,2,",",".")." = ".number_format($newOrder->totale + $spedizione,2,",",".")." &euro;</b></td>
										</tr>";
							if($newOrder->pagamento == 4) {
							  $alias = "payment_62320014";
							  $importo = number_format($spedizione,2,"","");
							  $codTrans = "TAT".$newOrder->pid."SP";
							  $mailTrans = $user->mail;
							  $session_id = "";
							  $chiavemac = "mhfn4WfIH1JQ2nUeunt4rvlvPvgRec2MPkSDl5vaw3qrZfMIEl18wpoYwqaTFVcX0TmJUETCNOpIZlvXec8Ec9qtkEwKRIeiUCS3h8bgbymL82Ezgs17q5Ln61fILh9cmYJNYJtEKvfnBnml4g3lCmZrMwjInG0tvA042nAg46jDdg4jpuLRLLaFTCL4OKsIfUjl5jwnBgM5tTiSK03ronSUa8WwSFdSuVqrLUYWywn5ynD5oZPRKvS0jxoKWTgT";
							  $mac = urlencode(base64_encode(md5("codTrans=$codTrans&divisa=EUR&importo=$importo".$chiavemac)));				
							  $message .= "<tr>
										 <td width=500>
										  Avendo scelto come metodo di pagamento <b>".$newOrder->getPagamento()."</b> puoi procedere al saldo dell'importo cliccando qui.<br>
								<form action=\"https://ecommerce.cim-italia.it/ecomm/DispatcherServlet\" method=POST target=_BLANK>
								<input type=hidden name=alias value=\"$alias\">
								<input type=hidden name=importo value=\"$importo\">
								<input type=hidden name=divisa value=\"EUR\">
								<input type=hidden name=codTrans value=\"$codTrans\">
								<input type=hidden name=mail value=\"$mailTrans\">
								<input type=hidden name=url value=\"#\">
								<input type=hidden name=session_id value=\"$session_id\">
								<input type=hidden name=mac value=\"$mac\">
								<input type=submit value=\"Effettua il pagamento delle SPESE DI SPEDIZIONE\">
								</form>
										 </td>
										</tr>";
							} else {
							   $message .= "<tr>
										 <td width=500>
										  L'importo finale da pagare � <b>".number_format($newOrder->totale + $spedizione,2,",",".")." &euro;</b>.
										 </td>
										</tr>";
							}
							$message .= "
							<tr>
							 <td width=500>
							  Grazie per aver scelto i nostri prodotti.<br>Un saluto dallo STAFF di www.lauropaolini.net
							 </td>
						</tr></table>
							</body>
							 </html>";
							 break;
							 							 
							 default:
				  			//invio l'importo all'utente eng
							$data = "$a/$m/$g";
							$subject = "Shipment cost from www.lauropaolini.net";
							$from = "MIME-Version: 1.0\nFrom: $adminmail\nReply-To: $adminmail\nContent-type: text/html; charset=iso-8859-1\n";
							$message = "<HTML>
		<HEAD> 
		<META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\"> 
		<link href=\"http://www.lauropaolini.net/CSS/tattoo.css\" rel=\"stylesheet\" type=\"text/css\"></HEAD>
		<body>
		<table width=500 class=plain cellpadding=2>
										<tr>
										  <td width=500>Dear Customer, we send you shipment cost about order N� TAT$pid closed in date $data.<br>
										  SHIPMENT COST = <b>".number_format($spedizione,2,",",".")." &euro;<br>
										  TOTAL ORDER COST = ".number_format($newOrder->totale,2,",",".")." + ".number_format($spedizione,2,",",".")." = ".number_format($newOrder->totale + $spedizione,2,",",".")." &euro;</b></td>
										</tr>";
							if($newOrder->pagamento == 4) {
							  $alias = "payment_62320014";
							  $importo = number_format($spedizione,2,"","");
							  $codTrans = "TAT".$newOrder->pid."SP";
							  $mailTrans = $user->mail;
							  $session_id = "";
							  $chiavemac = "mhfn4WfIH1JQ2nUeunt4rvlvPvgRec2MPkSDl5vaw3qrZfMIEl18wpoYwqaTFVcX0TmJUETCNOpIZlvXec8Ec9qtkEwKRIeiUCS3h8bgbymL82Ezgs17q5Ln61fILh9cmYJNYJtEKvfnBnml4g3lCmZrMwjInG0tvA042nAg46jDdg4jpuLRLLaFTCL4OKsIfUjl5jwnBgM5tTiSK03ronSUa8WwSFdSuVqrLUYWywn5ynD5oZPRKvS0jxoKWTgT";
							  $mac = urlencode(base64_encode(md5("codTrans=$codTrans&divisa=EUR&importo=$importo".$chiavemac)));				
							  $message .= "<tr>
										 <td width=500>
										  You can pay SHIPMENT COST with <b>".$newOrder->getPagamento_eng()."</b> , click on the button.<br>
								<form action=\"https://ecommerce.cim-italia.it/ecomm/DispatcherServlet\" method=POST target=_BLANK>
								<input type=hidden name=alias value=\"$alias\">
								<input type=hidden name=importo value=\"$importo\">
								<input type=hidden name=divisa value=\"EUR\">
								<input type=hidden name=codTrans value=\"$codTrans\">
								<input type=hidden name=mail value=\"$mailTrans\">
								<input type=hidden name=url value=\"#\">
								<input type=hidden name=session_id value=\"$session_id\">
								<input type=hidden name=mac value=\"$mac\">
								<input type=submit value=\"Pay Shipment cost\">
								</form>
										 </td>
										</tr>";
							} else {
							   $message .= "<tr>
										 <td width=500>
										  Total order cost is <b>".number_format($newOrder->totale + $spedizione,2,",",".")." &euro;</b>.
										 </td>
										</tr>";
							}
							$message .= "
							<tr>
							 <td width=500>
							  Thanks for your confidence in us!<br> www.lauropaolini.net STAFF 
							 </td>
						</tr></table>
							</body>
							 </html>";
							 break;
					}
				 	$mail = $user->mail;
                	mail($mail, $subject, $message, $from);
					Header("Location:pop_order.php?pid=$pid");
					die("<script language=Javascript>window.opener.location.reload();</script>");			  
				} else {
				   header("Refresh: 3;URL=pop_order.php?pid=$pid");
				   die("<div class=plain align=center>Errore nell'operazione. Attendi...</div>");
				}
			  break;

			  case "feedback":
								$min = $_GET['min'];
								$max = $_GET['max'];
								$page = $_GET['page'];
								$tipo = $_GET['tipo'];
							   $content = "<table width=600 cellpadding=0 class=content>
							   				<tr>
											 <td width=100% align=center class=tbtit>Gestione Feedback</td>
											</tr>
											<tr>
											 <td width=100%>".feedback::getFeedback2("content",$min,$max,$page)."</td>
											</tr>
											</table>";
			  break;
			  
			  case "modfeed":
			    $idfeed = $_GET['idfeed'];
				$newFeed = new feedback($idfeed);
				$content = "<table width=600 cellpadding=0 class=content>
							   				<tr>
											 <td width=100% align=center class=tbtit>Modifica Feedback</td>
											</tr>
											<tr>
											 <td width=100%>
											  <table width=100% cellpadding=3 class=content>
											   <form name=modfeed action=webuser.php method=POST>
											   <tr>
											    <td width=100 align=right>Da:</td>
												<td>".$newFeed->webuser."</td>
											   </tr>
											   <tr>
											    <td width=100 align=right valign=top>Commento:</td>
												<td><textarea name=testo cols=100 rows=10>".$newFeed->testo."</textarea></td>
											   <tr>
											    <td colspan=2 align=center>
												<input type=hidden name=op value=updfeed>
												<input type=hidden name=idfeed value=\"$idfeed\">
												<input type=image src=\"imgs/ico_save.gif\" title=\"Salva\"> - <a href=\"javascript:document.modfeed.submit();\">Salva</a></td>
											   </tr>
											   </form>
											  </table>
											 </td>
											</tr>
											</table>";
			  break;
			  
			  case "updfeed":
			    $idfeed = $_POST['idfeed'];
				$testo = $_POST['testo'];
				$newFeed = new feedback($idfeed);
			    $error = $newFeed->update($testo);
				$content = printError($error);
			  break;
			  
			  case "deletefeed":
			    $idfeed = $_GET['idfeed'];
				$newFeed = new feedback($idfeed);
				$error = $newFeed->delete();
				$content = printError($error,"webuser.php?op=feedback");
			  break;
			  
			  case "pubblica":
			    $idfeed = $_GET['idfeed'];
				$newFeed = new feedback($idfeed);
				$error = $newFeed->pubblica();
				if($error == "0")  {
				  Header("Location:webuser.php?op=feedback");
				  die();
				} else
				   $content = printError($error);				  
			  break;
			  
			  case "censura":
			    $idfeed = $_GET['idfeed'];
				$newFeed = new feedback($idfeed);
				$error = $newFeed->censura();
				if($error == "0")  {
				  Header("Location:webuser.php?op=feedback");
				  die();
				} else
				   $content = printError($error);				  
			  break;
			  
			  case "doAnswer":
			    $idfeed = $_GET['idfeed'];
				$newFeed = new feedback($idfeed);
				$content = "<table width=600 cellpadding=0 class=content>
							   				<tr>
											 <td width=100% align=center class=tbtit>Rispondi a  Feedback</td>
											</tr>
											<tr>
											 <td width=100%>
											  <table width=100% cellpadding=3 class=content>
											   <form name=doans action=webuser.php method=POST>
											   <tr>
											    <td width=100 align=right>A:</td>
												<td>".$newFeed->webuser."</td>
											   </tr>
											   <tr>
											    <td width=100 align=right>Commento:</td>
												<td>".$newFeed->testo."</td>
											   </tr>
											   <tr>
											    <td width=100 align=right valign=top>Risposta:</td>
												<td><textarea name=testo cols=100 rows=10></textarea></td>
											   <tr>
											    <td colspan=2 align=center>
												<input type=hidden name=op value=saveAns>
												<input type=hidden name=idfeed value=\"$idfeed\">
												<input type=image src=\"imgs/ico_save.gif\" title=\"Salva\"> - <a href=\"javascript:document.doans.submit();\">Salva</a></td>
											   </tr>
											   </form>
											  </table>
											 </td>
											</tr>
											</table>";
			  break;
			  
			  case "saveAns":
			    $idfeed = $_POST['idfeed'];
				$testo = $_POST['testo'];
				$newAns = new feedanswer();
				$error = $newAns->save($idfeed,$testo);
				$content = printError($error);
			  break;
			  
			  case "Answer":
			    $idfeed = $_GET['idfeed'];
				$newFeed = new feedback($idfeed);
				$qry = "SELECT idans FROM feedanswer WHERE idfeed='$idfeed' ORDER BY data_ans DESC;";
				$rs = $conn->Execute($qry);
				$content = "<table width=600 cellpadding=0 class=content>
							   				<tr>
											 <td width=100% align=center class=tbtit>Risposte al Feedback N�".$newFeed->idfeed." di ".$newFeed->webuser."</td>
											</tr>
											<tr>
											 <td width=100%>";
				if($rs->RecordCount() > 0)  {
				  $content .= "<table width=600 class=content cellpadding=2>
		  <tr class=tbtit>
		   <td width=40 class=tit02>Risposta</td>
		   <td width=100 class=tit02>Data</td>
		   <td width=100>Azioni</td>
		  </tr>";
				  while(!$rs->EOF)  {
				    $newAns = new feedanswer($rs->Fields("idans"));
				    $content .= "<tr>
					 				<td>".$newAns->testo."</td>
									<td>".$newAns->data_ans."</td>
									<td><a href=\"webuser.php?op=deleteAns&idans=".$newAns->idans."&idfeed=$idfeed\" onclick='return confirm(\"Sei sicuro di voler eliminare questa risposta?\")'><img src=\"imgs/ico_delete.gif\" width=16 height=16 alt=\"cancella\" title=\"cancella\" border=\"0\"></a></td>
								 </tr>";
					$rs->MoveNext();			 
				  }
				  $rs->Close();
				  $content .= "</table>";
				} else {
				   $content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" class=content>
                <tr>
                 <td width=100% align=center>Nessuna risposta per questo feedback.</td>
				</tr>
			</table>";
				}
				$content .= "</td>
								</tr>
							</table>";
			  break;
			  
			  case "deleteAns":
			    $idfeed = $_GET['idfeed'];
			    $idans = $_GET['idans'];
				$newAns = new feedanswer($idans);
				$error = $newAns->delete();
				if($error == "0") {
				  Header("Location:webuser.php?op=Answer&idfeed=$idfeed");
				  die();
				} else
				   $content = printError($error);
			  break;
			  
			  case "vendite":
			    $num = $_GET['num'];
				if($num != "")  {
				  setcookie("num",$num,time() + $_CONFIG['expire']);
				} else
				   $num = $_COOKIE['num'];
				if($num == "")
				  $num = 20;
			    $content = order::getStat($num);
			  break;
			  
			  case "changestato":
			    $stato_order = $_GET['stato'];
				$pid = $_GET['pid'];
				$order = new order($pid);
			    $content = printError($order->change($stato_order),"webuser.php?op=vendite");
			  break;
			  
			  case "sendtesto":
			    $pid = $_GET['pid'];
				$order = new order($pid);
			    $content = printError($order->sendTesto(),"webuser.php?op=vendite");
			  break;

			  case "mailtopay":
				$pid = $_GET['pid'];
				$order = new order($pid);
			    $content = printError($order->mailtopay(),"webuser.php?op=vendite");
			  break;
			  
			  case "send_password":
			    $idwebuser = $_GET['idwebuser'];
				$newUser = new webuser($idwebuser);
				$error = $newUser->send_password();
				$content = printError($error,"webuser.php");
			  break;
			  
			  case "delOrder":
			    $pid = $_GET['pid'];
				$newOrder = new order($pid);
				$error = $newOrder->delete();
				if($error == "0")  {
				  header("Location:webuser.php?op=vendite");
				  die();
				} else 
				   $content = printError($error,"webuser.php?op=vendite");
			  break;
			  
			  case "search_ordine":
			  	$num = 20;
			  	$search = $_POST['search'];
			  	$content = order::search($num,$search);
			  break;
			  
			  case "setEsportare":
			  	$pid = $_POST['pid'];
			  	$esportare = $_POST['esportare'];
			  	$newOrder = new order($pid);
			  	$newOrder->setEsporta($esportare);
			  	die('{"success":true}');
			  	break;
			  	
########################## ANAGRAFICA FORNITORI / PRODUTTORI ####################################à
			  	case "anag_prod":
			  		$content = "<table width=600 class=content cellpadding=3>
			  					<tr><td class=tbtit colspan=2>ANAGRAFICA FORNITORI</td></tr>
			  				  	<tr>
			  				  	<td colspan=2>
			  				  	<table width=100% class=content cellpadding=2>
			  				  	<tr>
			  				  	<td class=tbtit width=400>FORNITORE</td>
			  				  	<td class=tbtit align=center>AZIONI</td>
			  				  	</tr>";
			  		$qry = "SELECT id,fornitore FROM fornitore WHERE giardino=1 ORDER BY fornitore;";
			  		$rs = $conn->Execute($qry);
			  		if($rs->RecordCount()>0) {
			  			while(!$rs->EOF) {
			  				$content .= '<tr>
			  			 		<td style="border-bottom:1px solid #3B88C2;">'.$rs->Fields("fornitore").'</td>
			  			 		<td align="center" style="border-bottom:1px solid #3B88C2;">
			  			 		<a href="javascript:;" onClick="modFornitore('.$rs->Fields("id").')"><img src="imgs/ico_edit.gif" /></a>&nbsp;&nbsp;
			  			 		<a href="javascript:;" onClick="if(confirm(\'Sei sicuro di voler eliminare questo Fornitore? Procedere?\')) delFornitore('.$rs->Fields("id").')"><img src="imgs/ico_delete.gif" /></a>
			  			 		</td>
			  			 		</tr>';
			  				$rs->MoveNext();
			  			}
			  			$rs->Close();
			  		}
			  		$content .= '<tr>
			  			 <td colspan="2" id="mod-fornitore" style="display:none;border:1px solid #3B88C2;">
			  			 <p><b>MODIFICA FORNITORE</b></p>
			  			 <p>Fornitore:</p>
			  			 <p><input type="text" id="fornitore_mod" size="20" /></p>
			  			 <p><input type="button" id="upd-fornitore" value="SALVA MODIFICHE"></p>
			  			 </td>
			  			 </tr>
			  			 <tr>
			  			 <td colspan="2" id="add-fornitore" style="border:1px solid #3B88C2;">
			  			 <p><b>AGGIUNGI NUOVO FORNITORE</b></p>
			  			 <p>Fornitore:</p>
			  			 <p><input type="text" id="fornitore" size="20" /></p>
			  			 <p><input type="button" onClick="salvaFornitore();" value="SALVA NUOVO"></p>
			  			 </td>
			  			 </tr>';
			  		$content .= "</table></td></tr>
			  			 <form name=search action=webuser.php method=post>
			  					  <tr>
			  					  <tr><td class=tbtit colspan=2>ANAGRAFICA PRODUTTORI</td></tr>
			  					   <td align=left>Seleziona il PRODUTTORE ";
			  		$sql = "SELECT distinct produttore FROM articoli_new WHERE produttore!='' AND giardino=1 ORDER BY produttore ASC;";
			  		$rs_menu = $conn->Execute($sql);
			  		$content .= $rs_menu->GetMenu2("produttore","",false);
			  		$rs_menu->Close();
			  		$content .= "<input type='hidden' name='op' value='del_produttore'>
			  					  <input type=submit title=cerca value=\"ELIMINA PRODUTTORE\"></td></tr></form>
			  					  <form name=search action=webuser.php method=post enctype=\"multipart/form-data\">
			  					  <tr><td class=tbtit colspan=2>LOGO PRODUTTORI</td></tr>
			  					  <tr>
			  					   <td align=left>Seleziona il PRODUTTORE ";
			  		$sql = "SELECT distinct produttore FROM articoli_new WHERE produttore!='' AND giardino=1 ORDER BY produttore ASC;";
			  		$rs_menu = $conn->Execute($sql);
			  		$content .= $rs_menu->GetMenu2("produttore","",false);
			  		$rs_menu->Close();
			  		$content .= "<input type='hidden' name='op' value='logo_produttore'>Inserisci il logo(formato jpg,gif,png)
			  			 		  <input type=file name=logo size=30>
			  					  <input type=submit title=cerca value=\"CARICA LOGO PRODUTTORE\"></td></tr></form>
			  					  <form name=search action=webuser.php method=post>
			  					  <tr>
			  					   <td align=left>Seleziona il PRODUTTORE ";
			  		$sql = "SELECT distinct produttore FROM articoli_new WHERE produttore!='' AND giardino=1 ORDER BY produttore ASC;";
			  		$rs_menu = $conn->Execute($sql);
			  		$content .= $rs_menu->GetMenu2("produttore","",false);
			  		$rs_menu->Close();
			  		$content .= "<input type='hidden' name='op' value='del_logo_produttore'>
			  			 		  <input type=submit value=\"ELIMINA LOGO PRODUTTORE\"></td></tr>
			  					  </form>
			  					  </table>";
			  		break;
			  	
			  	case "getFornitore":
			  		$id = $_POST['id'];
			  		$qry = "SELECT id,fornitore FROM fornitore WHERE id=$id;";
			  		$rs = $conn->Execute($qry);
			  		die('{"fornitore":"'.utf8_encode($rs->Fields("fornitore")).'"}');
			  		break;
			  	
			  	case "updFornitore":
			  		$id = $_POST['id'];
			  		$fornitore = utf8_decode($_POST['fornitore']);
			  		$conn->Execute("UPDATE fornitore SET fornitore='$fornitore' WHERE id=$id;");
			  		die('{"success":true}');
			  		break;
			  	
			  	case "delFornitore":
			  		$id = $_POST['id'];
			  		$conn->Execute("DELETE FROM fornitore WHERE id=$id;");
			  		die('{"success":true}');
			  		break;
			  	
			  	case "salvaFornitore":
			  		$fornitore = utf8_decode($_POST['fornitore']);
			  		$conn->Execute("INSERT INTO fornitore VALUES(NULL,'$fornitore',1);");
			  		die('{"success":true}');
			  		break;
			  	
			  	case "del_produttore":
			  		$produttore = $_POST['produttore'];
			  		$conn->Execute("UPDATE articoli_new SET produttore='' WHERE produttore='$produttore';");
			  		header("Location: webuser.php?op=anag_prod");
			  		die();
			  		break;
			  	
			  	case "logo_produttore":
			  		$produttore = $_POST['produttore'];
			  		$logo = $_FILES['logo'];
			  		if($logo['name']!="") {
			  			$ext = strtolower(substr($logo['name'],-3));
			  			$file = $produttore.".".$ext;
			  			move_uploaded_file($logo['tmp_name'],$path_image."/brends/".$file) ? $error = "Logo inserito correttamente" : "Problemi nell'inserimento del logo";
			  		} else {
			  			$error = "Devi inserire un file.";
			  		}
			  		$content = printError($error);
			  		break;
			  	
			  	case "del_logo_produttore":
			  		$produttore = $_POST['produttore'];
			  		if(file_exists($path_image."brends/".$produttore.".jpg")) unlink($path_image."brends/".$produttore.".jpg");
			  		if(file_exists($path_image."brends/".$produttore.".gif")) unlink($path_image."brends/".$produttore.".gif");
			  		if(file_exists($path_image."brends/".$produttore.".png")) unlink($path_image."brends/".$produttore.".png");
			  		$content = printError("Logo eliminato con successo!");
			  		break;
			  	
			  	case "move":
			  		$idarticolo = $_POST['idarticolo'];
			  		$cid = $_POST['cid'];
			  		$origine = $_POST['origine'];
			  		category::move($idarticolo,$cid,1);
			  		header("Location: webuser.php?cid=$origine&op=product");
			  		die();
			  		break;
############################## VARIANTI ###############################################
			  			
			  		case "anag_varianti":
			  			$content = '<table width=600 class=content cellpadding=3>
			  						<tr><td class=tbtit colspan=2>ANAGRAFICA VARIANTI</td></tr>
			  						  <tr>
			  						  <td><div style="border:1px solid #3B88C2;padding:10px">
			  									  <p><input id="btn_new_attr" type="button" value="NUOVA VARIANTE" onClick="addVariante();"></p>
			  									  <div id="add_attr" style="display:none;">
			  									    <p>Nome Variante: <input type="text" id="nome_attr"  size="30"></p>
			  									    <p>Seleziona le categorie</p>
			  									    <p><select id="cids" name="cids[]" multiple="multiple" size="10">'.category::getCategorieFull().'</select></p>
			  									    <p><input type="button" value="SALVA" onClick="saveVariante();"></p>
			  									  </div>
			  									  <div id="list_attr">
			  									   '.Variante::listAttributi().'
			  									  </div>
			  									 </div>
			  									 </td>
			  						  </tr>
			  						</table>';
			  		break;
			  		
			  		case "getListAttributi":
			  			$cid = $_POST['cid'];
			  			die(Variante::listAttributi());
			  			break;
			  				
			  		case "saveVariante":
			  			$par = stripslashes($_REQUEST['json']);
			  			$json = json_decode($par);
			  			$error = Variante::saveAttributo(utf8_decode($json->nome),$json->cids);
			  			die('{json:'.json_encode(Variante::listAttributi()).'}');
			  			break;
			  				
			  		case "getVariante":
			  			$idattributo = $_POST['idattributo'];
			  			die(Variante::getAttributo($idattributo));
			  			break;
			  				
			  		case "updVariante":
			  			$par = stripslashes($_REQUEST['json']);
			  			$json = json_decode($par);
			  			$idattributo = $json->idattributo;
			  			$error = Variante::updAttributo($idattributo,utf8_decode($json->nome),$json->cids);
			  			die('{json:'.json_encode(Variante::listAttributi()).'}');
			  			break;
			  				
			  		case "delVariante":
			  			$idattributo = $_POST['idattributo'];
			  			$cid = $_POST['cid'];
			  			$error = Variante::delAttributo($idattributo);
			  			die(Variante::listAttributi());
			  			break;
			  				
			  		case "getValori":
			  			$idattributo = $_POST['idattributo'];
			  			$attributo = Variante::getNomeAttributo($idattributo);
			  			die('{"json":'.json_encode(Variante::listValori($idattributo)).',"attributo":'.json_encode($attributo).'}');
			  			break;
			  				
			  		case "saveValore":
			  			$par = stripslashes($_REQUEST['json']);
			  			$json = json_decode($par);
			  			$error = Variante::saveValore($json->idattributo,utf8_decode($json->valore),$json->start,$json->end,$json->passo);
			  			die('{json:'.json_encode(Variante::listValori($json->idattributo)).'}');
			  			break;
			  				
			  		case "getValore":
			  			$idattributo = $_POST['idattributo'];
			  			die(Variante::getAttributo($idattributo));
			  			break;
			  				
			  		case "updValore":
			  			$par = stripslashes($_REQUEST['json']);
			  			$json = json_decode($par);
			  			$idvalore = $json->idvalore;
			  			$valore = $json->valore;
			  			$idattributo = $json->idattributo;
			  			$error = Variante::updValore($idvalore,utf8_decode($valore));
			  			die('{json:'.json_encode(Variante::listValori($json->idattributo)).'}');
			  			break;
			  				
			  		case "delValore":
			  			$idvalore = $_POST['idvalore'];
			  			$idattributo = $_POST['idattributo'];
			  			$error = Variante::delValore($idvalore);
			  			die(Variante::listValori($idattributo));
			  			break;
#############################################################################################à
			  default:
			   $content = "&nbsp;";
			  break;

              }
		} else {
		$content = printError("Non sei autorizzato ad entrare in questa sezione");
	}
       break;

       case AUTH_NOT_LOGGED:
        header("Location:index.html");
       break;
}
?>
<html>
<head>
<title>Modulo Utenti Web</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style/style.css" rel="stylesheet" type="text/css">
<link type="text/css" href="js/theme/ui.all.css" rel="Stylesheet" />
<script language="javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-personalized-1.6rc6.js"></script>
<script language="javascript" src="js/functions.js"></script>
<script language="javascript" src="js/ajax.js"></script>
<script type="text/JavaScript">
<!--
<?=$javascript?>

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  var dis;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) {
	   obj=obj.style; 
	   if(v == 'show')  {
	     v = 'visible';
		 dis = 'block';
	   }
	   if(v == 'hide')  {
	     v = 'hidden';
		 dis = 'none';	 
	   }
	 }  
    obj.visibility = v; 
	obj.display = dis;
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function setEsportare(pid) {
	var esportare;
	$('#esportare_'+pid).is(":checked") ?
	esportare = 1 :
	esportare = 0;
	$.ajax({
		type : 'POST',
		url : 'webuser.php',
		data : 'op=setEsportare&pid=' + pid + '&esportare='+esportare,
		dataType : 'json',
		success : function(msg) {
			
		}
	});
}

$(document).ready(function(){
	  $('body').append('<div id="mod_attr"></div><div id="list_val_attr"></div>');
	});
//-->
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('imgs/icons/pag_web-b.gif','imgs/icons/info_utente-b.gif','imgs/icons/prodotti-b.gif','imgs/icons/newsletter-b.gif','imgs/icons/news-b.gif','imgs/icons/gest_banner-b.gif','imgs/icons/utenti-b.gif','imgs/icons/configurazione-b.gif','imgs/icons/kw-b.gif'); <?=$onload?>">
<!-- ImageReady Slices (gestione.psd - Slices: 02, 03, 04, 06, 07, 08, 09, 10, 11, 12) -->
<!-- End ImageReady Slices -->
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="40" height="177" background="imgs/bkgSx.gif">&nbsp;</td>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="552" background="imgs/gestione_02.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="360"><img src="imgs/spacer20.gif" width="360" height="73"></td>
            <td><table width="100%" height="73" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="5"><img src="imgs/spacer20.gif" width="45" height="5"></td>
              </tr>
              <tr>
                <td align="left" valign="middle" class="tit01"><!-- InstanceBeginEditable name="user" --><?=$username?><!-- InstanceEndEditable --></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
        <td background="imgs/gestione_03.gif">&nbsp;</td>
        <td width="221"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="imgs/gestione_04.gif" width="221" height="17" alt=""></td>
          </tr>
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="57"><a href="gestione.php?logout=1"><img src="imgs/gestione_06.gif" alt="Logout" width="57" height="51" border="0"></a></td>
                <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><a href="mailto:info@media-tek.it"><img src="imgs/gestione_07.gif" alt="" width="164" height="25" border="0"></a></td>
                  </tr>
                  <tr>
                    <td><a href="#"><img src="imgs/gestione_08.gif" alt="" width="164" height="26" border="0"></a></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><img src="imgs/gestione_09.gif" width="221" height="5" alt=""></td>
          </tr>
        </table></td>
      </tr>
    </table>
      <table width="100%" height="104" border="0" cellpadding="0"
			cellspacing="0">
			<tr>
				<td width="678" background="imgs/gestione_10.gif">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="203">
						<table width="203" height="104" border="0" cellpadding="0"
							cellspacing="0">
							<tr>
								<td><img src="imgs/spacer20.gif" width="203" height="65"></td>
							</tr>
							<tr>
								<td>
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td width="45"><img src="imgs/spacer20.gif" width="45"
											height="39"></td>
										<td>
										<table width="100%" height="39" border="0" cellpadding="5"
											cellspacing="0">
											<tr>
												<td align="left" valign="middle" class="module"><?=$module?>
												</td>
											</tr>
										</table>
										</td>
									</tr>
								</table>
								</td>
							</tr>
						</table>
						</td>
						<td>
						<table width="475" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="50"><img src="imgs/spacer20.gif" width="50"
									height="104" alt=""></td>
								<td align="left" valign="bottom"><? if($level!="VBL")  { ?>
								<table border="0" cellspacing="0" cellpadding="2">
									<tr>
									<?
									if($level=="admin")  {
										?>
										<td width="58"><a href="gestione.php?module=content"
											onMouseOut="MM_swapImgRestore()"
											onMouseOver="MM_swapImage('pages','','imgs/icons/pag_web-b.gif',1)"><img
											src="imgs/icons/pag_web.gif" alt="Pagine web" name="pages"
											width="58" height="69" border="0"></a></td>
										<td width="58"><a href="gestione.php?module=newsletter"
											onMouseOut="MM_swapImgRestore()"
											onMouseOver="MM_swapImage('Newsletter','','imgs/icons/newsletter-b.gif',1)"><img
											src="imgs/icons/newsletter.gif" alt="Newsletter"
											name="Newsletter" width="58" height="69" border="0"></a></td>
											<?
									}
									?>
										<td width="58"><a href="gestione.php?module=banner"
											onMouseOut="MM_swapImgRestore()"
											onMouseOver="MM_swapImage('banner','','imgs/icons/gest_banner-b.gif',1)"><img
											src="imgs/icons/gest_banner.gif" alt="Gestione Banner"
											name="banner" width="58" height="69" border="0"></a></td>
										<td width="58"><a href="gestione.php?module=prodotti"><img
											src="imgs/icons/prodotti.gif" alt="Pagine Web" name="pagine"
											width="58" height="69" border="0" id="pagine"
											onMouseOver="MM_swapImage('pagine','','imgs/icons/prodotti-b.gif',1)"
											onMouseOut="MM_swapImgRestore()"></a></td>
									</tr>
								</table>
								<? } ?></td>
							</tr>
						</table>
						</td>
					</tr>
				</table>
				</td>
				<td valign="bottom" background="imgs/gestione_11.gif">
				<table cellpadding="2" cellspacing="0">
					<tr>
						<td width="58"><a href="gestione.php?module=webuser"
							onMouseOut="MM_swapImgRestore()"
							onMouseOver="MM_swapImage('webutente','','imgs/icons/utenti-b.gif',1)"><img
							src="imgs/icons/utenti.gif" name="webutente" width="58"
							height="69" border="0"></a></td>
							<?
				if($level=="admin")  {
					?>
						<td width="58"><a href="gestione.php?module=user"
							onMouseOut="MM_swapImgRestore()"
							onMouseOver="MM_swapImage('Utente','','imgs/icons/info_utente-b.gif',1)"><img
							src="imgs/icons/info_utente.gif" name="Utente" width="58"
							height="69" border="0"></a></td>
						
				<?
				} else {
					?>&nbsp;<?
				}
				?>
						<td width="20" valign="middle">
						</td>
					</tr>
				</table>
				</td>
				<td width="95"><img src="imgs/gestione_12.gif" width="95"
					height="104" alt=""></td>
			</tr>
		</table>
    </td>
    <td width="40" background="imgs/bkgDx.gif">&nbsp;</td>
  </tr>
  <tr>
    <td background="imgs/bkgSx.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F6F6F6"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="203" align="left" valign="top" bgcolor="#DFDFDF" class="menusx"><!-- InstanceBeginEditable name="menuSx" --><?=$menusx?><!-- InstanceEndEditable --></td>
        <td align="left" valign="top" bgcolor="#EFEFEF" class="content"><!-- InstanceBeginEditable name="content" --><?=$content?><!-- InstanceEndEditable --></td>
      </tr>
    </table>
      <table width="100%" height="50" border="0" cellpadding="5" cellspacing="0">
        <tr>
          <td background="imgs/gestione_03.gif" bgcolor="#F6F6F6" class="copy"><p>2006&copy; Gestione moduli dinamici - release 1.2 - Powered by Media-tek </p></td>
        </tr>
      </table></td>
    <td background="imgs/bkgDx.gif">&nbsp;</td>
  </tr>
</table>
<div id="mod_attributo" style="display: none;">
<label>Attributo:</label><input
	type="text" id="nome_attr_edit" name="nome_attr_edit">
</div>
</body>
<!-- InstanceEnd --></html>